<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/html" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
	<link rel="stylesheet" href="/css/index.css"/>
	<script src="/js/main.js"></script>
	<title th:text="${setting.siteName}+'-个人中心'">易书网</title>
</head>
<style>
	.help-main p {
		line-height: 50px;
	}
</style>
<body >


<!--引入 尾部片段-->
<div  th:replace="mall/common/mall_common :: header"></div>


<div class="help-wrap">
	<div class="container clearfix">
		<div class="bread">当前位置：
			<a href="index.html">首页</a> >
			<a href="member.html">个人中心</a> >
			<a href="password.html">修改密码</a>
		</div>
		<div  th:replace="mall/common/mall_common :: left"></div>
		<div class="help-r fr">
			<div class="help-item-title">个人信息</div>
			<div class="help-main">
				<form action="">
					<input type="hidden" th:value="${session.mallUser.id}" name="id" id="mallId">
					<p><span class="nice">原始密码：</span><input type="text" value="" id="password" required="required" oninvalid="setCustomValidity('请填写原密码！');" oninput="setCustomValidity('');"></p>
					<p><span class="nice">新密码：</span><input type="password" value="" id="newPassword" required="required" oninvalid="setCustomValidity('请填写新密码！');" oninput="setCustomValidity('');"></p>
					<p><span class="nice">确认新密码：</span><input type="password" value="" id="repassword" required="required" oninvalid="setCustomValidity('请填写确认密码！');" oninput="setCustomValidity('');"></p>
					<h3 id="messages" style="color: red; margin-left: 100px"></h3>
					<input class="save" type="submit" value="确认修改" id="submits"/>

				</form>
			</div>
		</div>
	</div>
</div>





<!--引入 尾部片段-->
<div  th:replace="mall/common/mall_common :: footer"></div>
<script  src="js/jquery-3.4.1.js" th:src="@{/js/jquery-3.4.1.js}"></script>
<script>
	 $("form").submit(function () {
		 var password=$("#password").val();
		 var newPassword=$("#newPassword").val();
		 var repassword=$("#repassword").val();
		 var  mallId=$("#mallId").val();

		$.ajax({
			url:"/user/updatePassWord",
			data:{"password":password,"newPassWord":newPassword,"repassword":repassword,"id":mallId},
			dataType:"json",
			type:"post",
			success:function (data) {
				console.log(data)
				if (data.success){
					$("#messages").html("")
					$("#messages").append(data.content);

				}
					$("#messages").html("")
					$("#messages").append(data.content);
			}
		})
		 return false;
	 })


	$("#dataList").click(function () {
		var data = $("#bookName").val();
		console.log(data)
		location.href="/mall/list.html?bookName="+data;
		return false;
	})
</script>

</body>
</html>